package com.siyuanren.gcocp.exception;

import com.siyuanren.gcocp.common.exception.BaseException;
import lombok.extern.slf4j.Slf4j;

/**
 * Created by   guwr
 * Project_name education
 * Path         com.siyuanren.gcocp.counsel.exception.GcocpException
 * Date         2017/3/14
 * Time         11:06
 * Description
 */
@Slf4j
public class WxException extends BaseException {

    public static final WxException URL_ISNULL = new WxException(40001, "URL为空");
    public static final WxException IS_NOT_NULL = new WxException(40003, "不能为空");
    public static final WxException PAY_ERROR = new WxException(40004, "订单支付错误");

    public WxException() {
        super();
    }

    public WxException(int code, String msgFormat, Object... args) {
        super(code, msgFormat, args);
    }

    public WxException(int code, String msg) {
        super(code, msg);
    }

    public static void main(String[] args) {
        BaseException exception = new BaseException(2, "asdfasdf");
        System.out.println("args = " + (exception instanceof BaseException));
    }

    /**
     * 实例化异常
     *
     * @param msgFormat
     * @param args
     * @return
     */
    @Override
    public WxException newInstance(String msgFormat, Object... args) {
        return new WxException(this.code, msgFormat, args);
    }

    public WxException print() {
        log.info("==>WxException, code:" + this.code + ", msg:" + this.msg);
        return new WxException(this.code, this.msg);
    }
}
